<?php

//add shortcode 'horario'
function horario_shortcode($attr = array(), $content = null) {
        // default parameters
        $attr = shortcode_atts(array(
                'titulo' => 'Titulo', 
                'direccion' => 'Primera linea',
                'imagen' => 'imagen.jpg',
                'map_id' => '0',
                'map_width' => '320px',
                'map_height' => '212px',
                'map_lat' => '-12.110914',
                'map_long' => '-77.042924',
                'map_zoom' => 16,
                'map_html' => 'Specchi!',
            ), $attr);
        
        // create html
        $out = "<div class='horario-item'>";
        
        /*$out .= "map_id=".$attr['map_id']."/";
        $out .= "map_lat=".$attr['map_lat']."/";
        $out .= "map_long=".$attr['map_long']."/";
        $out .= "map_zoom=".$attr['map_zoom'];*/
        
        $out .= "   <div class='horario-image'>";
            if ($attr['map_id'] == "0"){
                $out .= "       <img alt='".$attr['titulo']."' src='".$attr['imagen']."'/>";
            }else {
                $out .= do_shortcode('[googlemap_custom  id="'.$attr['map_id']
                                                    .'" width="'.$attr['map_width']
                                                    .'" height="'.$attr['map_height']
                                                    .'" lat="'.$attr['map_lat']
                                                    .'" long="'.$attr['map_long']
                                                    .'" zoom="'.$attr['map_zoom']
                                                    .'" marker_html="'.$attr['map_html'].'"]');
            }
        $out .= "   </div>";
        $out .= "   <div class='horario-content'>";
        $out .= "       <h3 class='horario-title'>".$attr['titulo']."</h3>";
        $out .= "       <div class='horario-address'>".$attr['direccion']."</div>";
        $out .= "       <div class='horario-separator'></div>";
        $out .= "       <div class='horario-text'>".do_shortcode($content)."</div>";
        $out .= "   </div>";
        $out .= "</div>";
        return $out;
}
add_shortcode('horario', 'horario_shortcode');

?>
